<?php 
/**
 * @version $Id: admin.sketchup.html.php,v 1.3 2009/06/04 20:13:37 dgravato Exp $
 * @package    sketchup
 * @subpackage 
 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on 06-May-2009
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); 

class HTML_sketchups 
{ 
	function editSketchup( $row, $lists, $option ) 
	{ 
		$editor =& JFactory::getEditor(); 
		JHTML::_('behavior.calendar'); 
		jimport('joomla.html.html');
		?> 
		<form action="index.php" method="post" name="adminForm" id="adminForm"> 
		<fieldset class="adminform"> 
		<legend>Project # <?php echo $row->id;?> Details</legend> 
		<table class="admintable"> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			First Name: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="f_name"  id="f_name" size="75" maxlength="250" 
			   value="<?php echo $row->f_name;?>" /> 
		  </td> 
		</tr> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			Last Name: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="l_name"  id="l_name" size="75" maxlength="250" 
			   value="<?php echo $row->l_name;?>" /> 
		  </td> 
		</tr> 
		
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			Email: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="email" 
			   id="email" size="75" maxlength="250" 
			   value="<?php echo $row->email;?>" /> 
		  </td> 
		</tr> 
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			Country: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="country" 
			   id="country" size="75" maxlength="250" 
			   value="<?php echo $row->country;?>" /> 
		  </td> 
		</tr>
			<tr> 
		  <td width="100" align="right" class="key"> 
			City: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="city" 
			   id="city" size="75" maxlength="250" 
			   value="<?php echo $row->city;?>" /> 
		  </td> 
		</tr>
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			Model Location: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="location" 
			   id="location" size="75" maxlength="250" 
			   value="<?php echo $row->location;?>" /> 
		  </td> 
		</tr>
		
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			Project Title: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="p_title" 
			   id="p_title" size="75" maxlength="250" 
			   value="<?php echo $row->p_title;?>" /> 
		  </td> 
		</tr> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			Project Decription: 
		  </td> 
		  <td> 
			<?php 
			echo $editor->display( 'p_description',	 $row->p_description , '100%', '250', '40', '10' ) ; 
			?> 
		  </td> 
		</tr> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			Image 1: 
		  </td> 
		  <td> <img src="<?php $i1_clean = str_replace( "/uploads/", "/site/", $row->image1); echo $i1_clean; ?>"/><br/>
			<input class="text_area" type="text" name="image1" 
			   id="image1" size="75" maxlength="255" 
			   value="<?php $i1_clean = str_replace( "/www/release/guggenheim/www.guggenheim.org/docs/", "/", $row->image1); echo $i1_clean; ?>" /> 
			   
			   
			   
		  </td> 
		</tr> 
		<tr colspan="3"> 
		  <td width="100" align="right" class="key"> 
			Thumbnail 1: 
		  </td> 
		 
		  <td> <?php  if ($row->thumb1 == "") echo "NO THUMBNAIL SAVED YET !"; else echo"";?>
		  	<img src ="<?php echo $row->thumb1;?>" width="60" height="40"/>
			<input class="text_area" type="text" name="thumb1" 
			   id="thumb1" size="75" maxlength="255" 
			   value="<?php $t1_clean = str_replace( "/www/release/guggenheim/www.guggenheim.org/docs/images/content/sketchup/uploads/", "/images/content/sketchup/thumbs/", $row->image1); if ($row->thumb1 == "") echo $t1_clean; else echo $row->thumb1;  ?>" /> 
		  </td> 
		  
		</tr>
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			Image 2: 
		  </td> 
		  <td> <img src="<?php $i2_clean = str_replace( "/uploads/", "/site/", $row->image2); echo $i2_clean; ?>"/><br/>
			<input class="text_area" type="text" name="image2" 
			   id="image2" size="75" maxlength="255" 
			   value="<?php $i2_clean = str_replace("/www/release/guggenheim/www.guggenheim.org/docs/", "/", $row->image2); echo $i2_clean; ?>" /> 
		  </td> 
		</tr>
		<tr> 
		  <td width="100" align="right" class="key"> 
			Image 3: 
		  </td> 
		  <td> <img src="<?php $i3_clean = str_replace( "/uploads/", "/site/", $row->image3); echo $i3_clean; ?>"/><br/>
			<input class="text_area" type="text" name="image3" 
			   id="image3" size="75" maxlength="255" 
			   value="<?php $i3_clean = str_replace( "/www/release/guggenheim/www.guggenheim.org/docs/", "/", $row->image3); echo $i3_clean; ?>" /> 
		  </td> 
		</tr>
		<tr> 
		  <td width="100" align="right" class="key"> 
			Image 4: 
		  </td> 
		  <td> <img src="<?php $i4_clean = str_replace( "/uploads/", "/site/", $row->image4); echo $i4_clean; ?>"/><br/>
			<input class="text_area" type="text" name="image4" 
			   id="image4" size="75" maxlength="255" 
			   value="<?php $i4_clean = str_replace("/www/release/guggenheim/www.guggenheim.org/docs/", "/", $row->image4); echo $i4_clean; ?>" /> 
		  </td> 
		</tr>
		
		
		<tr> 
		  <td width="100" align="right" class="key"> 
			3D Warehouse URL: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="m_url" 
				 id="m_url" size="75" maxlength="250" 
				 value="<?php echo $row->m_url;?>" /> 
		  </td> 
		</tr> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			YouTube Video URL: 
		  </td> 
		  <td> 
			<input class="text_area" type="text" name="v_url" id="v_url" size="75" maxlength="250" 
			     value="<?php echo $row->v_url;?>" /> 
		  </td> 
		</tr>
		<tr> 
		  <td width="100" align="right" class="key"> 
			Submitted Date: 
		  </td> 
		  <td> 
			<?php echo JHTML::calendar($row->sub_date, 'sub_date', 'sub_date'); ?>
		  </td> 
		</tr> 
		<tr> 
		  <td width="100" align="right" class="key"> 
			Finalist: 
		  </td> 
		  <td> 
			<?php 
			echo $lists['finalist']; 
			?> 
		  </td> 
		</tr>
		<tr> 
		  <td width="100" align="right" class="key"> 
			Published: 
		  </td> 
		  <td> 
			<?php 
			echo $lists['published']; 
			?> 
		  </td> 
		</tr> 
		</table> 
		</fieldset> 
		<input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 
		<input type="hidden" name="option" value="<?php echo $option;?>" />
		<input type="hidden" name="task" value="" /> 
		<?php echo JHTML::_( 'form.token' ); ?>
		</form> 
		<?php 
	}
	
	function showSketchups( $option, &$rows, &$pageNav  ) 
	{ 
	  ?> 
	  <form action="index.php" method="post" name="adminForm"> 
	  <table class="adminlist"> 
	    <thead> 
	      <tr> 
	        <th width="20"> 
	          <input type="checkbox" name="toggle" 
	               value="" onclick="checkAll(<?php echo 
	               count( $rows ); ?>);" /> 
	        </th> 
	        <th class="title">Full Name</th> 
	        <th width="25%">email</th> 
	        <th width="25%">Project Titile</th> 
	        <th width="20%">Submitted Date</th> 
	   		<th width="5%" nowrap="nowrap">Finalist</th> 
	        <th width="5%" nowrap="nowrap">Published</th> 
	      </tr> 
	    </thead> 
	    <?php
		jimport('joomla.filter.output');
	    $k = 0;
	    for ($i=0, $n=count( $rows ); $i < $n; $i++) 
	    {
			$row = &$rows[$i]; 
			$checked = JHTML::_('grid.id', $i, $row->id );
			$published = JHTML::_('grid.published', $row, $i );
			$link = JFilterOutput::ampReplace( 'index.php?option=' . $option . '&task=edit&cid[]='. $row->id );
	      ?> 
	      <tr class="<?php echo "row$k"; ?>"> 
	        <td> 
	          <?php echo $checked; ?> 
	        </td> 
	        <td>
			<a href="<?php echo $link; ?>"> 
	          <?php echo $row->f_name; ?> <?php echo $row->l_name; ?></a>
	        </td> 
	        <td> 
	          <?php echo $row->email; ?> 
	        </td> 
	        <td> 
	        <a href="<?php echo $link; ?>"> 
	          <?php echo $row->p_title; ?> </a>
	        </td>
	        <td> 
	          <?php echo $row->sub_date; ?> 
	        </td> 
	    	 <td align="center"> 
	          <?php  if ($row->finalist == "1") echo "yes"; else echo "no";?> 
	        </td> 
	        <td align="center"> 
	          <?php echo $published;?> 
	        </td> 
	      </tr> 
	      <?php 
	      $k = 1 - $k; 
	    } 
	    ?> 
	 	<tfoot> 
		 <td colspan="7"><?php echo $pageNav->getListFooter(); ?></td> 
		</tfoot>
	  </table>
	  <input type="hidden" name="option" value="<?php echo $option;?>" /> 
	  <input type="hidden" name="task" value="" /> 
	  <input type="hidden" name="boxchecked" value="0" /> 
	  <?php echo JHTML::_( 'form.token' ); ?>
	  </form> 
	  <?php 
	}
	
	function showComments( $option, &$rows, &$pageNav ) 
	{ 
	  ?> 
	  <form action="index.php" method="post" name="adminForm"> 
	  <table class="adminlist"> 
	    <thead> 
	      <tr> 
	        <th width="20"> 
	        <input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /> 
	        </th> 
	        <th class="title">Project Title</th> 
	        <th width="15%">Commenter</th> 
	        <th width="20%">Comment Date</th> 
	        <th width="30%">Comment</th> 
	      </tr> 
	    </thead> 
	    <?php 
	    jimport('joomla.filter.output'); 
	    $k = 0; 
	    for ($i=0, $n=count( $rows ); $i < $n; $i++) { 
	      $row = &$rows[$i]; 
	      $checked = JHTML::_('grid.id', $i, $row->id ); 
	      $link = JFilterOutput::ampReplace( 'index.php?option=' . $option . '&task=editComment&cid[]='. $row->id ); 
	      ?>
		      <tr class="<?php echo "row$k"; ?>"> 
		        <td><?php echo $checked; ?></td> 
		        <td><a href="<?php echo $link; ?>"><?php echo $row->p_title; ?></a></td> 
		        <td><?php echo $row->full_name; ?></td> 
		        <td><?php echo JHTML::Date($row->comment_date); ?></td> 
		        <td><?php echo substr($row->comment_text, 0, 149); ?></td> 
		      </tr> 
		      <?php 
		      $k = 1 - $k; 
		    } 
		    ?> 
		  <tfoot> 
		    <td colspan="5"><?php echo $pageNav->getListFooter(); ?></td> 
		  </tfoot> 
		  </table> 
		  <input type="hidden" name="option" 
		                       value="<?php echo $option;?>" /> 
		  <input type="hidden" name="task" value="comments" /> 
		  <input type="hidden" name="boxchecked" value="0" /> 
		  <?php echo JHTML::_( 'form.token' ); ?>
		  </form> 
		  <?php  
	} 
	
	function editComment ($row, $option) 
	{ 
	  JHTML::_('behavior.calendar'); 
	  $editor =& JFactory::getEditor();
	  ?> 
	  <form action="index.php" method="post" name="adminForm" id="adminForm"> 
	    <fieldset class="adminform"> 
	      <legend>Comment</legend> 
	      <table> 
	      <tr> 
	        <td width="100" align="right" class="key"> 
	          Name: 
	        </td> 
	        <td> 
	          <input class="text_area" type="text" name="full_name" id="full_name" size="75" maxlength="250" value="<?php echo $row->full_name;?>" /> 
	        </td> 
	      </tr>
		      <tr> 
		        <td width="100" align="right" class="key"> 
		          Comment: 
		        </td> 
		        <td> <?php
		        		echo $editor->display( 'comment_text',	 $row->comment_text , '100%', '250', '40', '10' ) ; 
		          	?>
		        </td> 
		      </tr> 
		      <tr> 
		        <td width="100" align="right" class="key"> 
		          Comment Date: 
		        </td> 
		        <td>          
				  <?php echo JHTML::calendar($row->comment_date, 'comment_date', 'comment_date'); ?>
		        </td> 
		      </tr> 
		      </table> 
		    </fieldset> 
		    <input type="hidden" name="id" value="<?php echo $row->id; ?>" /> 
		    <input type="hidden" name="option" value="<?php echo $option; ?>" /> 
		    <input type="hidden" name="task" value="" /> 
			<?php echo JHTML::_( 'form.token' ); ?>
		  </form> 
		  <?php 
	}
	
	function showSketchupsThumbs( $option, &$rows, &$pageNav) 
	{ 
	  ?> 
	  <form action="index.php" method="post" name="adminForm"> 
	  <table class="adminlist"> 
	    <thead> 
	      <tr> 
	        <th width="20"> 
	          <input type="checkbox" name="toggle" 
	               value="" onclick="checkAll(<?php echo 
	               count( $rows ); ?>);" />	        </th> 
	        <th class="title">Name</th> 
	        <th width="10%">Project Titile</th> 
	        <th width="20%">Thumbnails</th>
	        <th width="10%">Make new</th> 
	   		<th width="25%" nowrap="nowrap">Upload</th> 
            <th width="5%" nowrap="nowrap">Submitted Date</th>
            <th width="5%" nowrap="nowrap">Published</th>
	      </tr> 
	    </thead> 
	    <?php
		jimport('joomla.filter.output');
	    $k = 0;
	    for ($i=0, $n=count( $rows ); $i < $n; $i++) 
	    {
			$row = &$rows[$i]; 
			$checked = JHTML::_('grid.id', $i, $row->id );
			$published = JHTML::_('grid.published', $row, $i );
			$link = JFilterOutput::ampReplace( 'index.php?option=' . $option . '&task=makeThumb&cid[]='. $row->id );
	      ?> 
	      <tr class="<?php echo "row$k"; ?>"> 
	        <td> 
	          <?php echo $checked; ?>	        </td> 
	        <td>
			 
	          <?php echo $row->f_name; ?> <?php echo $row->l_name; ?>        </td> 
	       
	        <td> 
	         
	          <?php echo $row->p_title; ?></td>
	        
	          <td> 
	          
	          <?php $path = '/images/content/sketchup/thumbs'; $t1_clean= str_replace( '/images/content/sketchup/thumbs/', 'images/content/sketchup/thumbs/', $row->thumb1); ?>
	          
	          
	          <?php  if ($row->thumb1 == "") echo "HAS NO THUMB!"; else echo JHTML::_('image', $t1_clean, $row->p_title,'width="80" height="60" border="0"' ); ?> </td>
	        
	        <td>path notes</td> 
	    	 <td align="center"><p> cleaned path: <?php echo $t1_clean ;?><br/> 
	    	 regular path : <?php echo $row->thumb1;?><br/>
	    	 thubnails live in: <?php $searchpath = JPATH_ROOT . DS . "images". DS ."content" . DS ."skethup". DS . "thumbs" ; echo $searchpath; ?></p>
	    	 </td> 
	     
            
             <td align="center"> 
	          <p><?php echo $row->sub_date; ?></p>	        </td> 
	        <td align="center"> 
            <p><?php echo $published;?></p>	        </td> 
	      </tr> 
	      <?php 
	      $k = 1 - $k; 
	    } 
	    ?> 
	 	<tfoot> 
	 	 
		 <td colspan="9"><?php echo $pageNav->getListFooter(); ?></td> 
		 
		 
		</tfoot>
	  </table>
	  <input type="hidden" name="option" value="<?php echo $option;?>" /> 
	  <input type="hidden" name="task" value="thumbs" /> 
	  <input type="hidden" name="boxchecked" value="0" /> 
	  <?php echo JHTML::_( 'form.token' ); ?>
	  </form> 

	  <?php 
	  }
	  
	  
}  //this is the end
?>
